package org.edu.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.AssertFalse;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.annotations.Proxy;

@Entity
@Proxy(lazy = false)
@Table(name = "SEMESTER", catalog = "SCHOOL")
public class Semester implements Serializable {

	private static final long serialVersionUID = 1L;
	private Long semester_id;
	@NotNull
	@Size(min=4, max=20, message="Semester Not Valid")
	private String semester_name;
	
	@NotNull(message="Please Enter A Valid Date!")
	private Date semester_date;
	@AssertFalse
	private Boolean status_smt;

	@Id
	@Column(name="SEMESTER_ID")
	@GeneratedValue
	public Long getSemester_id() {
		return semester_id;
	}

	public void setSemester_id(Long semester_id) {
		this.semester_id = semester_id;
	}
	
	@Column(name="SEMESTER_NAME")
	public String getSemester_name() {
		return semester_name;
	}

	public void setSemester_name(String semester_name) {
		this.semester_name = semester_name;
	}

	@Column(name="SEMESTER_DATE")
	public Date getSemester_date() {
		return semester_date;
	}

	public void setSemester_date(Date semester_date) {
		this.semester_date = semester_date;
	}

	@Column(name="STATUS_SMT")
	public Boolean getStatus_smt() {
		return status_smt;
	}

	public void setStatus_smt(Boolean status_smt) {
		this.status_smt = status_smt;
	}


	public Semester() {
		super();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((semester_date == null) ? 0 : semester_date.hashCode());
		result = prime * result
				+ ((semester_id == null) ? 0 : semester_id.hashCode());
		result = prime * result
				+ ((semester_name == null) ? 0 : semester_name.hashCode());
		result = prime * result
				+ ((status_smt == null) ? 0 : status_smt.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Semester other = (Semester) obj;
		if (semester_date == null) {
			if (other.semester_date != null)
				return false;
		} else if (!semester_date.equals(other.semester_date))
			return false;
		if (semester_id == null) {
			if (other.semester_id != null)
				return false;
		} else if (!semester_id.equals(other.semester_id))
			return false;
		if (semester_name == null) {
			if (other.semester_name != null)
				return false;
		} else if (!semester_name.equals(other.semester_name))
			return false;
		if (status_smt == null) {
			if (other.status_smt != null)
				return false;
		} else if (!status_smt.equals(other.status_smt))
			return false;
		return true;
	}
	
}
